angular.module('factory', ['ionic'])
  .config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider

      .state('welcome', {
        url: '/welcome',
        templateUrl: 'views/welcome/welcome.html'
      })

      .state('login', {
        url: '/login',
        templateUrl: 'views/login/login.html'
      })

      .state('home', {
        url: '/home',
        templateUrl: 'views/home/home.html'
      })

      .state('client', {
        url: '/client',
        templateUrl: 'views/client/client.html'
      })

      .state('clientedit', {
        url: '/clientedit/:id/:isview',
        templateUrl: 'views/client/client_edit.html'
      });

    $urlRouterProvider.otherwise('/welcome');
  })

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})
